package com.huatech.controller;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.huatech.domain.User;
import com.huatech.service.UserService;

@Controller
public class UserController {

	private static final String ADD_PAGE = "/user/addPage";
	private static final String DO_ADD = "/user/doAdd";
	
	@Autowired UserService userService;
	
	@RequestMapping(value = ADD_PAGE)
	public String addPage(){
		return ADD_PAGE;
	}
	
	@RequestMapping(value= DO_ADD)
	@ResponseBody
	public Object doAdd(User user){
		user.setCreateTime(new  Date());
		userService.insert(user);
		return user;		
	}
	
		
}


